package com.qtjf.qtmoneyservice.view;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.qtjf.qtmoneyservice.R;
import com.qtjf.qtmoneyservice.activity.FirstActivity;
import com.qtjf.qtmoneyservice.activity.SecondActivity;
import com.qtjf.qtmoneyservice.activity.ThreeActivity;
import com.qtjf.qtmoneyservice.constantSet.Constant;
import com.qtjf.qtmoneyservice.widget.ShenFenDialog;

/**
 * Created by Administrator on 2017/8/1 0001.
 */

public class ShenFenZidongView {

    Context mContext;
    View mView;
    ImageView layout1;
    ImageView layout2;
    TextView submitBt;

    public ShenFenZidongView(Context mContext) {
        this.mContext = mContext;
    }

    public View getView()
    {
        mView=View.inflate(mContext, R.layout.shenfen_zidong_view,null);
        initView();
        initData();
        initEvent();
        return mView;
    }

    private void initView() {

        layout1= (ImageView) mView.findViewById(R.id.layout1);
        layout2= (ImageView) mView.findViewById(R.id.layout2);

        LinearLayout.LayoutParams params= (LinearLayout.LayoutParams) layout1.getLayoutParams();
        params.height= (int)(((Constant.getSCREENWIDTH()-180*Constant.getSCALE())/(219.0/144.0)));
        layout1.setLayoutParams(params);

        LinearLayout.LayoutParams params1= (LinearLayout.LayoutParams) layout2.getLayoutParams();
        params1.height= (int)(((Constant.getSCREENWIDTH()-180*Constant.getSCALE())/(219.0/144.0)));
        layout2.setLayoutParams(params1);

        submitBt= (TextView) mView.findViewById(R.id.submit_bt);
    }

    private void initData() {
    }

    private void initEvent() {
        submitBt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                ShenFenDialog dialog=new ShenFenDialog(mContext,R.style.myTransparent,null);
                dialog.show();
            }
        });

        layout1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               // mContext.startActivity(new Intent(mContext, ThreeActivity.class));
                Toast.makeText(mContext,"已屏蔽",Toast.LENGTH_SHORT).show();
            }
        });

        layout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               // mContext.startActivity(new Intent(mContext, SecondActivity.class));
                Toast.makeText(mContext,"已屏蔽",Toast.LENGTH_SHORT).show();
            }
        });
    }

}
